<div class="center">
	<div class="home">
        <div class="home_left">
            <?php echo $this->partial('member/menu.phtml',array('uCount' => $this->uCount,'menuId'=>$this->menuId,'user'=>$this->user,'account'=>$this->account)); ?>
        </div>
        <div class="home_right">
        
        
            <div class="shezhi">
            	<h1><i></i>个人设置</h1>
            </div>
            
            <div class="shezhinav">
                <ul>
                    <li><a href="/member/profile"><i class="shezhi1"></i>个人信息设置</a></li>
                    
                    <li class="shezhion"><a href="/member/password"><i class="shezhi3"></i>修改登录密码</a></li>
                    <?php if($this->User->State == 0){ ?>
                    <li><a href="/member/email"><i class="shezhi3"></i>修改邮箱</a></li>
                    <?php } ?>
                </ul>
            </div>
        <form id="form1" method="post">
    	
      
    		<div class="mimatishi">
            	<h1>为了更好的保护您的帐号安全，避免您的损失，建议您设置密码时：</h1>
                <ul>
                	<li>1. 先将电脑全面杀毒，再设置新密码；</li>
                	<li>2. 不要设置和其它不正规网站相同的密码。</li>
                </ul>
            </div>
            <div class="mimatable">
            	<table>
                	<tr>
                    	<td class="mz"><span>*</span>当前密码：</td>
                        
                        <!--class="texting"输入状态，class=""空为平常状态-->
                        <td><input class="texting" id="old_password" name="old_password" type="password" /><p id="div_input_password" style="display:none"><i></i>请输入旧密码</p></td>
                    </tr>
                	<tr>
                    	<td class="mz"><span>*</span>新密码：</td>
                        <td>
                        	<input type="password" id="password" name="password" /><p id="div_password" style="display:none;"><i></i>新密码不能为空</p>
                            <strong>密码由6-16个字符组成，区分大小写，不能包含空格</strong>
                        </td>
                    </tr>
                	<tr>
                    	<td class="mz"><span>*</span>确认新密码：</td>
                        <td>
                        	<input type="password" id="password2" name="password2" /><p id="div_password2" style="display:none;"><i></i>确认新密码不能为空</p><p id="div_password_not_right" style="display:none;"><i></i>输入的两次密码不一致</p>
                        </td>
                    </tr>
                </table>
                
                <div class="mimatijiao">
                	<a onclick="javascript:formsubmit()"><span>提交修改</span></a>
                </div>
                
            </div>

        </form>


        </div>
        

    </div>
</div>

<script language="javascript">
	function check_form()
	{
		var old_password = $("#old_password").val();
		if(old_password == "")
		{
			$("#div_input_password").show();
			$("#old_password").focus();

			return false;
		}
		else
		{
			$("#div_input_password").hide();
		}

		var password = $("#password").val();
		if(password == "")
		{
			$("#div_password").show();
			$("#password").focus();

			return false;
		}
		else
		{
			$("#div_password").hide();
		}

		var password2 = $("#password2").val();
		if(password2 == "")
		{
			$("#div_password2").show();
			$("#password2").focus();

			return false;
		}
		else
		{
			$("#div_password2").hide();
		}

		if(password != password2)
		{
			$("#div_password_not_right").show();
			$("#password2").focus();
			return false;
		}
		else
		{
			$("#div_password_not_right").hide();
		}

		return true;
	}

	function formsubmit()
	{		
		if(check_form())
		{
			var old_password = $("#old_password").val();
			var password = $("#password").val();
			var password2 = $("#password2").val();
			jQuery.ajax({
	            type: "POST",
	            url: "/member/password/",
	            data: {"old_password":old_password,"password":password,"password2":password2},
	            dataType:"json",
	            success: function(obj){
	            	if(obj.ret == 1)
	    			{
		    			window.location.href = "/member/passwordsuccess";
	    			}
	    			else
	    			{
		    			switch(obj.ret)
		    			{
		    				case -1:
			    				alert("旧密码不正确");
			    				break;
		    			}
	    			}
	            }
	        });
		}
	}
</script>
